package org.rency.spring.cloud.boot.mvc.repository;

import org.rency.spring.cloud.boot.mvc.dao.MemberDao;
import org.rency.spring.cloud.boot.mvc.domain.MemberDomain;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;
import java.util.List;

/**
 * ${todo}
 *
 * @author: Created by user_rcy@163.com on 2016/8/22.
 * @version: V1.0.0
 * @since JDK 1.8
 */
@Repository("memberRepository")
public class MemberRepositoryImpl implements MemberRepository{

    @Resource(name="memberDao")
    private MemberDao memberDao;

    @Override
    public MemberDomain getLogin(String loginName) {
        return memberDao.getByLogin(loginName);
    }

    @Override
    public boolean add(MemberDomain member) {
        return memberDao.insert(member) == 1;
    }

    @Override
    public boolean remove(String memberId) {
        return memberDao.delete(memberId) == 1;
    }

    @Override
    public MemberDomain get(String memberId) {
        return memberDao.get(memberId);
    }

    @Override
    public List<MemberDomain> loadAll() {
        return memberDao.loadAll();
    }
}
